package com.deep.stream.consumer.controller;

import com.deep.stream.consumer.sender.MsgScale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author deeprado
 */
@RestController
@RequestMapping("send")
public class SendMsgController {

    @Autowired
    private MsgScale msgScale;

    @GetMapping("/sendMessage")
    public void process() {
        String message = "now" + new Date();
        msgScale.output().send(MessageBuilder.withPayload(message).build());
    }
}
